Current Location: Home> Function Categories> floor

floor

Leave the method of sorting
Name:floor
Category:math
Programming Language:php
One-line Description:Round down to the closest integer.

Definition and usage

floor() function rounds down to the closest integer.

Example

In this example, we will apply floor() function to different numbers:

 <?php
echo ( floor ( 0.60 ) ) ;
echo ( floor ( 0.40 ) ) ;
echo ( floor ( 5 ) ) ;
echo ( floor ( 5.1 ) ) ;
echo ( floor ( - 5.1 ) ) ;
echo ( floor ( - 5.9 ) )
?>

Try it yourself

grammar

 floor ( x )
parameter describe
x Required. A number.

illustrate

Returns the next integer no greater than x and rounds the decimal part of x . The type returned by floor() is still float, because the range of float values ​​is usually larger than integer.

Similar Functions